<template>
  <el-dialog title="销售备注" :visible.sync="dialogVisible" v-if="dialogVisible">
    <el-form ref="form" :model="form">
      <el-form-item label="销售备注" prop="salenote">
        <el-input placeholder="请输入销售备注" type="textarea" rows="5" v-model="form.salenote" style="width:600px">

        </el-input>
      </el-form-item>

    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="commit">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import goodsListApi from "../../../api/gameConfig/goodsList";
export default {
  data() {
    return {
      dialogVisible: false,
      loading: false,
      supplyList: [],
      interNameList: [],
      form: {
        salenote: '',
        id: ''
      },
      isEdit: false
    };
  },
  created() {


  },
  methods: {
    open(row, flag) {
      this.form.id = row.id
      if (flag == 'edit') {
        this.isEdit = true
        this.form.salenote = row.salenote
      } else {
        this.isEdit = false
        this.form.salenote = ''
      }
      this.dialogVisible = true;
    },

    commit() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.isEdit) {
            goodsListApi.editSalenote(this.form).then(res => {
              this.dialogVisible = false
              this.$modal.msgSuccess(res.msg);
              this.$parent.getList()
            })
          } else {
            goodsListApi.salePickUp(this.form).then(res => {
              this.dialogVisible = false
              this.$modal.msgSuccess(res.msg);
              this.$parent.getList()
            })
          }
        }
      })
      // goodsListApi.deleteAllAccount(this.deleteForm).then(res => {
      //   if (res.code == 200) {
      //     this.$modal.msgSuccess("操作成功");
      //     this.$parent.search()
      //     this.close();
      //   }
      // });
    },
    close() {
      this.dialogVisible = false;
    }
  }
};
</script>
<style scoped lang="css">
.center {
  text-align: center;
}

.pick-dialog>>>.el-dialog {
  margin-top: 100px !important;
}

.form-box {
  width: 100%;
}

::v-deep .el-input-number.is-without-controls .el-input__inner {
  text-align: left;
}
</style>
